import {DynamicModule, Module } from '@nestjs/common';
import { CourseService } from './course.service';
import { CourseController } from './course.controller';

@Module({})
export class CourseModule {
  static forRoot(options): DynamicModule {
    const providers = [
      {
        provide: 'CONFIG_OPTIONS',
        useValue: options
      },
      CourseService
    ]

    return {
      module: CourseModule,
      providers: providers,
      controllers: [CourseController],
      exports: ['CONFIG_OPTIONS']
    }
  }
}
